FROM ubuntu:20.04

ARG PYTHON_VERSIONS
ENV PYTHON_VERSIONS=${PYTHON_VERSIONS}
ENV PATH="/root/miniconda3/bin:${PATH}"

RUN echo "PYTHON_VERSIONS=${PYTHON_VERSIONS}"

RUN apt-get update && apt-get install -y bash wget

RUN ARCH=$(uname -m) && \
    if [ "$ARCH" = "x86_64" ]; then \
        MINICONDA_FILE="Miniconda3-latest-Linux-x86_64.sh"; \
    elif [ "$ARCH" = "aarch64" ]; then \
        MINICONDA_FILE="Miniconda3-latest-Linux-aarch64.sh"; \
    else \
        echo "Unsupported architecture: $ARCH"; exit 1; \
    fi && \
    wget https://repo.anaconda.com/miniconda/$MINICONDA_FILE && \
    bash ./$MINICONDA_FILE -b -p /root/miniconda3 && \
    rm $MINICONDA_FILE
RUN /root/miniconda3/bin/conda init

COPY install.sh /root/install.sh
COPY version.py /root/version.py

RUN chmod +x /root/install.sh && bash /root/install.sh \

WORKDIR /www
CMD ["python", "/root/version.py"]